﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using ProjetCom.Ctrl;
using ProjetCom.Model.Snake;


namespace ProjetCom.Vue
{
    abstract class Level : IDisposable
    {
        protected CtrlTemplate m_Ctrl;
        private ContentManager m_Content;
        private Color m_Color = Color.CornflowerBlue;

        public Color ColorBackground
        {
            get { return m_Color; }
            protected set { m_Color = value; }
        }

        protected ContentManager Content
        {
            get { return m_Content; }
        }

        public Level(IServiceProvider p_serviceProvider, CtrlTemplate p_ctrl)
        {
            m_Content = new ContentManager(p_serviceProvider, "Content");

            m_Ctrl = p_ctrl;
        }

        protected void DrawScore(SpriteBatch p_spriteBatch)
        {
            SpriteFont font = m_Content.Load<SpriteFont>("SpriteFont/SpriteFont");
            string strLife = m_Ctrl.Score.ToString();

            p_spriteBatch.DrawString(font, strLife, new Vector2(0, 0), Color.White);
        }

        abstract public void Dispose();
        
        /// <summary>
        /// Dessine le niveau
        /// </summary>
        abstract public void Draw(SpriteBatch p_spriteBatch);
    }
}
